package com.hustcs.mindmap.util;

import com.hustcs.mindmap.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Gallery;
import android.widget.ImageView;
import android.widget.Gallery.LayoutParams;


public class ImageAdapter extends BaseAdapter {
	private Context context;
	private Integer[] imageThumbIds = {
		R.drawable.img_thumb_new,
		R.drawable.img_thumb_history,
		R.drawable.img_thumb_setting,
		R.drawable.img_thumb_exit,
	};
	
	public ImageAdapter(Context context) {
		this.context = context;
	}
	
	@Override
	public int getCount() {
		return imageThumbIds.length;
	}

	@Override
	 public Object getItem(int position) {
        return position;
    }

	@Override
    public long getItemId(int position) {
        return position;
    }

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ImageView imageView = new ImageView(context);
		imageView.setImageResource(imageThumbIds[position]);
		imageView.setAdjustViewBounds(true);
		imageView.setLayoutParams(new Gallery.LayoutParams(LayoutParams.WRAP_CONTENT, 
				LayoutParams.WRAP_CONTENT));
		imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
		 
       
		return imageView;
	}

}
